package com.itheima.inetaddress;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Demo09 {
    public static void main(String[] args) throws IOException {
        //创建服务器端对象
        ServerSocket ss = new ServerSocket(10000);

        //等待客服端发送数据
        Socket accept = ss.accept();

        //创建流接收数据
        InputStream is = accept.getInputStream();

        //读数据
        int a;
        while((a = is.read())!= -1){
            //打印数据
            System.out.print((char)a);
        }

        //写一个反馈
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));

        //写数据
        bw.write("你是谁?");


        ss.close();
        is.close();
        bw.close();
        accept.close();
    }
}
